from configobj import ConfigObj

# 读取配置文件
config = ConfigObj('relay_configuration(Fully_automatic).ini')

# 访问节、键和值
for section in config:
    print(f"Section: {section}")
    for key in config[section]:
        value = config[section][key]
        print(f"  Key: {key}, Value: {value}")
        if config.comments[section] and key in config.comments[section]:
            comment = config.comments[section][key]
            print(f"    Comment: {comment}")
